package com.kk.gray.feign;

import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

@Component
@FeignClient(value = "web",contextId = "ProviderFeignService",path = "/web")
// 引入配置（携带请求头）
//@FeignClient(value = "web",contextId = "ProviderFeignService",path = "/web",configuration = FeignConfiguration.class)
// path :携带路径
public interface ProviderFeignService {
    @GetMapping("/getData")
//    JSONObject getData(@RequestParam(name = "data") String data, @RequestHeader(name = "userId") String userId);
    JSONObject getData(@RequestParam(name = "data") String data);

    @PostMapping("/postData")
    JSONObject postData(@RequestBody Map<String, Object> data);

    @GetMapping("/getTest")
    String getTest();

}
